{% extends "base.html" %}
{% load static i18n %}

{% block head-title %}{% trans "Motions" %}{% endblock %}
{% block page-title %}{% trans "Motions" %}{% endblock %}

{% block content %}

  {# The context `rounds` contains all rounds before or at the current round, #}
  {# so `rounds` is guaranteed to be non-empty. #}
  {% for round in rounds %}
    <div class="card mt-3">
      <div class="list-group list-group-flush">

        {% include "components/form-title.html" with title=round.name %}
        {% if round.motions_released %}
          {% for r_motion in round.roundmotion_set.all %}
          {% with motion=r_motion.motion %}
            <li class="list-group-item d-flex flex-column flex-md-row align-items-md-center">
              {% if pref.enable_motions %}
                <div class="badge badge-info mr-3 d-none d-md-block">
                  {{ r_motion.seq }}
                </div>
              {% endif %}
              <div class="mr-auto pr-3 lead">
                {{ motion.text }}
              </div>
              {% if motion.info_slide %}
                <div class="pt-md-0 pt-2">
                  <button class="btn btn-sm btn-secondary btn-block"
                          data-toggle="modal" data-target="#info_{{ motion.id }}">
                    {% trans "View Info Slide" %}
                  </button>
                  {% include 'motions_info.html' %}
                </div>
              {% endif %}
            </li>
            {% endwith %}
          {% empty %}
            <li class="list-group-item list-group-item-secondary">
              {% trans "There are no motions available for this round." %}
            </li>
          {% endfor %}
        {% elif pref.enable_motions %}
          {# Translators: Used when there are expected to be several motions per round (e.g. Australs) #}
          <li class="list-group-item list-group-item-secondary">
            {% trans "The motions for this round have not been released." %}
          </li>
        {% else %}
          {# Translators: Used when there is expected to be one motion per round (e.g. WUDC) #}
          <li class="list-group-item list-group-item-secondary">
            {% trans "The motion for this round has not been released." %}
          </li>
        {% endif %}
      </div>
    </div>
  {% endfor %}

{% endblock content %}
